<?php
Database($_SESSION['cid']);
class NoticeAction extends Action{

    public function index(){
        $rs = pageing('notice',7,'',$_GET['seach'],'notice_id desc','notice_id','notice_title','',"DB_MEETING");

        $this->assign("rs",$rs);
        $this->display();
    }
    
    public function del()
    {
        $rs = D('Notice')->to_del_notice($_GET);
        if($rs){
            $this->success('删除成功',__URL__.'/index');
        }
        else
            $this->error('删除失败',__URL__.'/index');
    }
    

    public function to_add_information()
    {
        $rs = D('Information') ->add_information($_POST);
        if($rs)
            $this->success('添加信息成功',__APP__."/Information/index");
        else
            $this ->error('添加信息失败',__APP__."/Information/to_add");
    }

    
    public function add_act()
    {
        $rs = D('Notice') ->add_notice($_POST);
        if($rs)
            $this->success('添加信息成功',__APP__."/Notice/index");
        else
            $this ->error('添加信息失败',__APP__."/Notice/forAct");
    }

    public function deleteall(){
        $count = count($_POST['id']);
        $rs = M('notice' , '' , 'DB_MEETING');
        for($i = 0 ; $i < $count ; $i++)
        {
            $del = $rs->where('notice_id='.$_POST['id'][$i])->delete();
        }
        if($del){
            $this ->success("删除成功");
        }else{
            $this ->error("删除失败"); 
        }
    }
}